package com.example;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class AutoCreateTask {

    @Autowired
    private UserService userService;

    @Autowired
    private ArticleService articleService;

    @Scheduled(fixedRate = 5000)
    public void autoCreateUser() {
        Long userId = userService.createNewUser();
        log.info("autoCreateUser:{}", userId);
    }

    @Scheduled(fixedRate = 1000)
    public void autoCreateArticle() {
        Long articleId = articleService.createNewArticle();
        log.info("autoCreateArticle:{}", articleId);
    }
}
